<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" th:src="@{webjars/jquery/3.4.1/dist/jquery.min.js}"></script>
    <script type="text/javascript">
        $(function () {
            $(".delete").click(function () {
                alert("11");
                var href=this.href;
                $("#f1").attr("action",href).submit();
                return false;
            });
        });
    </script>
    <style>
        h1{
            text-align: center;
        }
        table{
            border-collapse: collapse;
            width: 600px;
            margin: 0 auto;
        }
        th,td{
            border: brown 1px solid;
            height: 40px;
            line-height: 40px;
            text-align: center;
        }
        tr:nth-child(odd){
            background-color: aqua;
        }
        #s1{
            width: 600px;
            margin: 0 auto;
            text-align: right;
        }
        #d1{
            width: 600px;
            margin: 0 auto;
        }
        input[name="minsal"],input[name="maxsal"]{
            width:100px;
        }
    </style>
</head>
<body>

    <h1>员工列表</h1>
    <div id="d1">
        <form th:action="@{/emp/search}" method="post">
        姓名：<input type="text" name="name">
        工资：<input type="text" name="minSal">-<input type="text" name="maxSal">
            <input type="text" name="pageNumber">-
            <input type="text" name="pageSize">
        <button>查询</button>
        </form>
        <p id="s1">
            <a th:href="@{/emp/view}">增加</a>
        </p>
    </div>
    <table>
        <tr>
            <th>员工编号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>工资</th>
            <th>生日</th>
            <th>职位</th>
            <th>操作</th>
        </tr>
        <tr th:each="emp:${emplist}">
            <td th:text="${emp.id}">1</td>
            <td th:text="${emp.name}">李斯特</td>
            <td>
                <span th:if="${emp.sex eq 'M'}">男</span>
                <span th:if="${emp.sex eq 'W'}">女</span>
                <span th:if="${emp.sex eq 'O'}">妖</span>
            </td>
            <td th:text="${emp.sal}">100000</td>
            <td th:text="${#dates.format(emp.birthday,'yyyy-mm-dd')}">1999-11-23</td>
            <td th:text="${emp.jobDec}">工程师</td>
            <td>
                <a th:href="@{'/emp/'+${emp.id}}">修改</a>
                |
                <a class="delete" th:href="@{|/emp/${emp.id}|}">删除</a>
            </td>
        </tr>
    </table>
</body>
<form method="post" id="f1">
    <input type="hidden" name="_method" value="DELETE">
</form>
</html>